Bitmap Buttons by Daniel Thomas Donated to the public domain CIS: 72301,2164 You should have 4 files: ReadMe.txt this file Buttons.pas Bitmap Buttons unit ButnTest.pas sample program ButnTest.res sample resource file EXPLANATION: ----------- The Buttons Unit defines 2 objects for use in creating and handling Bitmap Buttons. A button has 3 general appearances: Normal ("up") Pressed ("down") Disabled ("grayed") note: the other states, "selected" and "default" are not currently handled - see the NOTES section, below The tSingleBitmapButton object uses one bitmap, and draws lines to simulate the three states. You create a single bitmap for the button, with a gray background. You do not paint the "edges" or the border, but leave room for them in the gray background. You can create the button bitmaps in virtually any size (within reason) - this holds true for tMultiBitmapButtons, also. The tMultiBitmapButton object uses 3 bitmaps, one for each state. The purpose for this object is to allow you complete control over how the button will look in each of its states. For instance, a "pressed" button doesn't have to look like every other pressed button - be imaginative! You create each button in its entirety (don't you wish TPW had a spelling checker?), including the border and edges. It would be advisable to make them all the same size (the object assumes that they are). EXAMPLES: -------- The sample program ButnTest.pas includes examples of both types of buttons. Just compile it and run. In the sample program, clicking on one button will disable and re-enable the other button, so you can see what a "disabled" button looks like. The ButnTest.res file has the bitmaps for these buttons. THINGS LEFT TO DO: ------------------ There isn't a keyboard interface. There is nothing to differentiate a "default" button. My suggestion would be for tSingleBitmapButtons to draw a thicker border (thicker towards the inside, not the outside), and tMultiBitmapButtons to have an additional bitmap for this state - remember that the purpose of tMultiBitmapButtons is to give total control to the programmer. There is nothing to show a "selected" button. In normal buttons, this is shown by a dotted-line box around the text. I would recommend something like a dotted line box for tSingleBitmapButtons, and an additional bitmap for tMultiBitmapButtons. Painting on dialogs is not currently supported. If you're going to take into account changing system font sizes, etc, it can get complicated. Have fun. FINAL NOTES: ----------- Finally, you are free to use this code in any way you wish. No restrictions (although if you change something and post it to a BBS, please indicate your changes - I don't want someone blaming me for your lousy code . Dan Thomas 2301 N. Huron Circle Placentia, CA 92670 (714) 524-5625 Compuserve: 72301,2164 Prodigy: CWRF01A God bless. -Dan ----------------end-of-author's-documentation--------------- Software Library Information: This disk copy provided as a service of Public (software) Library We are not the authors of this program, nor are we associated with the author in any way other than as a distributor of the program in accordance with the author's terms of distribution. Please direct shareware payments and specific questions about this program to the author of the program, whose name appears elsewhere in this documentation. If you have trouble getting in touch with the author, we will do whatever we can to help you with your questions. All programs have been tested and do run. To report problems, please use the form that is in the file PROBLEM.DOC on many of our disks or in other written for- mat with screen printouts, if possible. PsL cannot debug pro- programs over the telephone, though we can answer questions. Disks in the PsL are updated monthly, so if you did not get this disk directly from the PsL, you should be aware that the files in this set may no longer be the current versions. Also, if you got this disk from another vendor and are having prob- lems, be aware that some files may have become corrupted or lost by that vendor. Get a current, working disk from PsL. For a copy of the latest monthly software library newsletter and a list of the 3,000+ disks in the library, call or write Public (software) Library P.O.Box 35705 - F Houston, TX 77235-5705 Orders only: 1-800-2424-PSL MC/Visa/AmEx/Discover Outside of U.S. or in Texas or for general information, Call 1-713-524-6394 PsL also has an outstanding catalog for the Macintosh.